package com.killer.texreader.util;

import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by killer on 2016/4/21.
 */
public class DBUtil extends SQLiteOpenHelper {
    public DBUtil(Context context) {
        super(context, "read.db", null, 1);
    }

    public DBUtil(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //文本表(多本书)
        String sql = "create table txt(id integer primary key,full_path txt,now_pager integer,over_flag integer)";
        db.execSQL(sql);

        //page表（每一本书的内容）
        sql = "create table page(id integer primary key,txt_id integer,page_num integer,content txt)";
        db.execSQL(sql);

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
